<?php

namespace app\api\controller;

use app\services\DesignerApplicationService;
use support\Request;

class DesignerApplicationController
{
    // 提交设计师申请
    public function apply(Request $request)
    {
        try {
            $data = $request->post();
            DesignerApplicationService::apply($data);

            return ok_rsp('申请提交成功');
        } catch (\Exception $e) {
            return err_rsp($e->getMessage());
        }
    }

    // 获取最新的申请状态
    public function getLatestStatus(Request $request)
    {
        try {
            $status = DesignerApplicationService::getLatestApplicationStatus();

            return ok_rsp('获取成功', $status);
        } catch (\Exception $e) {
            return err_rsp($e->getMessage());
        }
    }
}